home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Compilers / digital marsC compier / dm / include / win32 / Accctrl.h next >
Encoding:
C/C++ Source or Header  |  1996-08-08  |  8.5 KB  |  231 lines

  1. //+-------------------------------------------------------------------
  2. //
  3. //  Microsoft Windows
  4. //  Copyright (C) Microsoft Corporation, 1993-1996.
  5. //
  6. //  File:        accctrl.h
  7. //
  8. //  Contents:    common internal includes for
  9. //
  10. //  History:     8-94        Created         DaveMont
  11. //
  12. //--------------------------------------------------------------------
  13. #ifndef __ACCESS_CONTROL__
  14. #define __ACCESS_CONTROL__
  15.  
  16. #define AccFree LocalFree
  17. //--------------------------------------------------------------------
  18. //
  19. // NT specific access request structure definition
  20. //
  21. //--------------------------------------------------------------------
  22.  
  23. //
  24. // Definition: TRUSTEE_TYPE
  25. // This enumerated type specifies the type of trustee account for the trustee
  26. // returned by the API described in this document.
  27. // TRUSTEE_IS_UNKNOWN - The trustee is an unknown, but not necessarily invalid
  28. //                      type.  This field is not validated on input to the APIs
  29. //                      that take Trustees.
  30. // TRUSTEE_IS_USER      The trustee account is a user account.
  31. // TRUSTEE_IS_GROUP     The trustee account is a group account.
  32. //
  33. typedef enum _TRUSTEE_TYPE
  34. {
  35.     TRUSTEE_IS_UNKNOWN,
  36.     TRUSTEE_IS_USER,
  37.     TRUSTEE_IS_GROUP,
  38. } TRUSTEE_TYPE;
  39.  
  40.  
  41. //
  42. // Definition: TRUSTEE_FORM
  43. // This enumerated type specifies the form the trustee identifier is in for a
  44. // particular trustee.
  45. // TRUSTEE_IS_SID       The trustee is identified with a SID rather than with a name.
  46. // TRUSTEE_IS_NAME      The trustee is identified with a name.
  47. //
  48. typedef enum _TRUSTEE_FORM
  49. {
  50.     TRUSTEE_IS_SID,
  51.     TRUSTEE_IS_NAME,
  52. } TRUSTEE_FORM;
  53.  
  54.  
  55. //
  56. // Definition: MULTIPLE_TRUSTEE_OPERATION
  57. // If the trustee is a multiple trustee, this enumerated type specifies the type.
  58. // TRUSTEE_IS_IMPERSONATE       The trustee is an impersonate trustee and the multiple
  59. //                          trustee field in the trustee points to another trustee
  60. //                          that is a trustee for the server that will be doing the
  61. //                          impersonation.
  62. //
  63. typedef enum _MULTIPLE_TRUSTEE_OPERATION
  64. {
  65.     NO_MULTIPLE_TRUSTEE,
  66.     TRUSTEE_IS_IMPERSONATE,
  67. } MULTIPLE_TRUSTEE_OPERATION;
  68.  
  69.  
  70. //
  71. // Definition: TRUSTEE
  72. // This structure is used to pass account information into and out of the system
  73. // using the API defined in this document.
  74. // PMultipleTrustee     - if NON-NULL, points to another trustee structure, as
  75. //                    defined by the multiple trustee operation field.
  76. // MultipleTrusteeOperation - Defines the multiple trustee operation/type.
  77. // TrusteeForm - defines if the trustee is defined by name or SID.
  78. // TrusteeType - defines if the trustee type is unknown, a user or a group.
  79. // PwcsName     - points to the trustee name or the trustee SID.
  80. //
  81. typedef struct _TRUSTEE_A *PTRUSTEE_A;
  82. typedef struct _TRUSTEE_W *PTRUSTEE_W;
  83.  
  84. typedef struct _TRUSTEE_W
  85. {
  86.     PTRUSTEE_W                  pMultipleTrustee;
  87.     MULTIPLE_TRUSTEE_OPERATION  MultipleTrusteeOperation;
  88.     TRUSTEE_FORM                TrusteeForm;
  89.     TRUSTEE_TYPE                TrusteeType;
  90.     LPWSTR                      ptstrName;
  91. } TRUSTEE_W;
  92.  
  93. typedef struct _TRUSTEE_A
  94. {
  95.     PTRUSTEE_A                  pMultipleTrustee;
  96.     MULTIPLE_TRUSTEE_OPERATION  MultipleTrusteeOperation;
  97.     TRUSTEE_FORM                TrusteeForm;
  98.     TRUSTEE_TYPE                TrusteeType;
  99.     LPSTR                       ptstrName;
  100. } TRUSTEE_A;
  101.  
  102. #ifdef UNICODE
  103.     #define TRUSTEE     TRUSTEE_W
  104.     #define PTRUSTEE    PTRUSTEE_W
  105. #else
  106.     #define TRUSTEE     TRUSTEE_A
  107.     #define PTRUSTEE    PTRUSTEE_A
  108. #endif
  109.  
  110.  
  111. //
  112. // Definition: ACCESS_MODE
  113. // This enumerated type specifies how permissions are (requested)/to be applied
  114. //  for the trustee by the access control entry.  On input this field can by any
  115. //  of the values, although it is not meaningful to mix access control and audit
  116. //  control entries.  On output this field will be either SET_ACCESS, DENY_ACCESS,
  117. // SET_AUDIT_SUCCESS, SET_AUDIT_FAILURE.
  118. // The following descriptions define how this type effects an explicit access
  119. // request to apply access permissions to an object.
  120. // GRANT_ACCESS - The trustee will have at least the requested permissions upon
  121. //                successful completion of the command. (If the trustee has
  122. //                additional permissions they will not be removed).
  123. // SET_ACCESS - The trustee will have exactly the requested permissions upon
  124. //              successful completion of the command.
  125. // DENY_ACCESS - The trustee will be denied the specified permissions.
  126. // REVOKE_ACCESS - Any explicit access rights the trustee has will be revoked.
  127. // SET_AUDIT_SUCCESS - The trustee will be audited for successful opens of the
  128. //                     object using the requested permissions.
  129. // SET_AUDIT_FAILURE - The trustee will be audited for failed opens of the object
  130. //                     using the requested permissions.
  131. //
  132. typedef enum _ACCESS_MODE
  133. {
  134.     NOT_USED_ACCESS = 0,
  135.     GRANT_ACCESS,
  136.     SET_ACCESS,
  137.     DENY_ACCESS,
  138.     REVOKE_ACCESS,
  139.     SET_AUDIT_SUCCESS,
  140.     SET_AUDIT_FAILURE
  141. } ACCESS_MODE;
  142.  
  143. //
  144. // Definition: Inheritance flags
  145. // These bit masks are provided to allow simple application of inheritance in
  146. // explicit access requests on containers.
  147. // NO_INHERITANCE       The specific access permissions will only be applied to
  148. //                  the container, and will not be inherited by objects created
  149. //                  within the container.
  150. // SUB_CONTAINERS_ONLY_INHERIT  The specific access permissions will be inherited
  151. //                              and applied to sub containers created within the
  152. //                              container, and will be applied to the container
  153. //                              itself.
  154. // SUB_OBJECTS_ONLY_INHERIT     The specific access permissions will only be inherited
  155. //                              by objects created within the specific container.
  156. //                              The access permissions will not be applied to the
  157. //                              container itself.
  158. // SUB_CONTAINERS_AND_OBJECTS_INHERIT   The specific access permissions will be
  159. //                                      inherited by containers created within the
  160. //                                      specific container, will be applied to
  161. //                                      objects created within the container, but
  162. //                                      will not be applied to the container itself.
  163. //
  164. #define NO_INHERITANCE 0x0
  165. #define SUB_CONTAINERS_ONLY_INHERIT  0x2
  166. #define SUB_OBJECTS_ONLY_INHERIT  0x1
  167. #define SUB_CONTAINERS_AND_OBJECTS_INHERIT 0x3
  168.  
  169.  
  170. //
  171. // Definition:
  172. // This enumerated type defines the objects supported by the get/set API within
  173. // this document.  See section 3.1, Object Types for a detailed definition of the
  174. // supported object types, and their name formats.
  175. //
  176. typedef enum _SE_OBJECT_TYPE
  177. {
  178.     SE_UNKNOWN_OBJECT_TYPE = 0,
  179.     SE_FILE_OBJECT,
  180.     SE_SERVICE,
  181.     SE_PRINTER,
  182.     SE_REGISTRY_KEY,
  183.     SE_LMSHARE,
  184.     SE_KERNEL_OBJECT,
  185.     SE_WINDOW_OBJECT
  186. } SE_OBJECT_TYPE;
  187.  
  188.  
  189. //
  190. // Definition: EXPLICIT_ACCESS
  191. // This structure is used to pass access control entry information into and out
  192. // of the system using the API defined in this document.
  193. // grfAccessPermissions - This contains the access permissions to assign for the
  194. //                     trustee.  It is in the form of an NT access mask.
  195. // grfAccessMode - This field defines how the permissions are to be applied for
  196. //                 the trustee.
  197. // grfInheritance - For containers, this field defines how the access control
  198. //                  entry is/(is requested) to be inherited on
  199. //                  objects/sub-containers created within the container.
  200. // Trustee - This field contains the definition of the trustee account the
  201. //           explicit access applies to.
  202. //
  203. typedef struct _EXPLICIT_ACCESS_W
  204. {
  205.     DWORD        grfAccessPermissions;
  206.     ACCESS_MODE  grfAccessMode;
  207.     DWORD        grfInheritance;
  208.     TRUSTEE_W    Trustee;
  209. } EXPLICIT_ACCESS_W, *PEXPLICIT_ACCESS_W;
  210.  
  211. typedef struct _EXPLICIT_ACCESS_A
  212. {
  213.     DWORD        grfAccessPermissions;
  214.     ACCESS_MODE  grfAccessMode;
  215.     DWORD        grfInheritance;
  216.     TRUSTEE_A    Trustee;
  217. } EXPLICIT_ACCESS_A, *PEXPLICIT_ACCESS_A;
  218.  
  219. #ifdef UNICODE
  220.     #define EXPLICIT_ACCESS     EXPLICIT_ACCESS_W
  221.     #define PEXPLICIT_ACCESS    PEXPLICIT_ACCESS_W
  222. #else
  223.     #define EXPLICIT_ACCESS     EXPLICIT_ACCESS_A
  224.     #define PEXPLICIT_ACCESS    PEXPLICIT_ACCESS_A
  225. #endif
  226.  
  227.  
  228. #endif // __ACCESS_CONTROL__
  229.  
  230.  
  231.